﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using UI.ParentForm;
using Components;
using UI.Lib;
using System.Collections;
using UI.Lib.Factory;

namespace UI.StorageManagement
{
    public partial class FrmTranPreDoc : BasePrint
    {
        public FrmTranPreDoc()
        {
            InitializeComponent();

            this.Text = "配货单打印";
        }

        protected override DataTable SetReportSummaryData()
        {
            return UI.Lib.Factory.CommonHelper.Entity.ExecFun("printranpredoc", new KeyValuePair<string, object>("listid", base.GetParamByKey("listid")));
        }

        //返回明细数据
        protected override DataTable SetReportDetailData()
        {
            return UI.Lib.Factory.CommonHelper.Entity.ExecFun("printranpredetail", new KeyValuePair<string, object>("listid", base.GetParamByKey("listid")));
        }

        protected override void AfterReport()
        {
            Hashtable hsWhere = new Hashtable();
            hsWhere["tranid"] = base.GetParamByKey("listid");

            string errmsg = CommonHelper.Entity.SaveDtl("Sto7a00Manager$SaveData", StringUtil.Entity.TableToJson(hsWhere), "P", null, null);
            bool isSuccess = string.IsNullOrEmpty(errmsg); // 是否保存成功
            if (!isSuccess)
            {
                MessageBox.Show(errmsg, "提示");
                IsReportOk = false;
            }
            else 
            {
                IsReportOk = true;
            }
        }
    }
}